<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>组件化编程-全局组件</title>
</head>
<body>
<div id="app">
    <h1>组件化编程-全局组件</h1>
    <counter></counter>
    <counter></counter>
    <counter></counter>
</div>

<div id="app2">
    <h1>组件化编程-全局组件-app2</h1>
    <counter></counter>
    <counter></counter>
    <counter></counter>
</div>
<script src="vue.js"></script>
<script>
    Vue.component("counter",{
        template: '<button v-on:click="click()">点击次数= {{count}} 次【全局组件化】</button>',
        data(){
            return {
                count: 10
            }
        },
        methods:{
            click(){
                this.count++;
            }
        }
    })

    //创建Vue实例，必须有
    let vm = new Vue({
        el: "#app"
    })

    let vm2 =  new Vue({
        el: "#app2"//Vue实例的挂载点
    })
</script>
</body>
</html>